package ar.edu.unq.leezsi.requestcycle;

import ar.edu.unq.leezsi.utils.Strings;

public class InternalRequestParams {

	private int backButtonIndex;
	private String pageClass;

	public InternalRequestParams(String uri) {
		this.parse(uri);
	}

	public int getBackButtonIndex() {
		return this.backButtonIndex;
	}

	public String getPageClass() {
		return this.pageClass;
	}

	private void parse(String uri) {
		System.out.println("uri   " + uri);
		String[] parts = uri.split("/");
		String pageURI = parts[1];
		String[] params = pageURI.split(":");
		this.pageClass = params[0];
		this.backButtonIndex = params.length > 2 ? Strings.getInt(params[1])
				: -1;
	}

}
